
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题页</title>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/Style.css" />
<link type="text/css" href="__PUBLIC__/css/jquery-ui-1.8.16.custom.css"
	rel="stylesheet" />
<link href="__PUBLIC__/libs/css/import_basic.css" rel="stylesheet"
	type="text/css" />
<link href="__PUBLIC__/libs/skins/blue/style.css" rel="stylesheet"
	type="text/css" id="theme" themeColor="blue" />
<script type="text/javascript" src="__PUBLIC__/libs/js/jquery.js"></script>
<script type="text/javascript" src="__PUBLIC__/libs/js/framework.js"></script>

<style type="text/css">
table {
	padding: 0px;
	margin: 0px;
}

th,tr,td {
	text-align: center;
	line-height: 28px;
	height: 28px;
}

th {
	background-image: url(__PUBLIC__/images/th_bg.jpg);
	background-color: #06C;
}

table {
	border-collapse: collapse;
}

th,td {
	vertical-align: middle;
	border: 1px dotted #DDD;
	border-collapse: collapse;
}

table td span {
	color: #999999;
}

td {
	cursor: pointer;
}

.dis {
	display: block
}

.undis {
	display: none
}

.navul {
	width: 100%;
	margin: 0 auto;
	height: 26px;
	padding-top: 4px;
}

.navul li {
	float: left;
	width: 98px;
	height: 26px;
	padding-right: 5px
}

.navul li a {
	float: left;
	width: 98px;
	height: 26px;
	text-align: center;
	line-height: 26px
}

.navul li.nav_current {
	color: #00F;
	background: url(__PUBLIC__/images/a_1.gif) no-repeat 0 0;
}

.navul li.nav_link {
	color: #333;
	background: url(__PUBLIC__/images/a_2.gif) no-repeat 0 0;
}

.nav-down {
	height: 100px;
	border: 1px solid #000;
	text-align: left
}
</style>


<script type="text/javascript">
      (function($){
          $.getUrlParam = function(name)
          {
              var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
              var r = window.location.search.substr(1).match(reg);
              if (r!=null) return unescape(r[2]); return null;
          }
      })(jQuery);
  $(document).ready(function(){
    $(".data_list tr td.remarktd").dblclick(function() {
     var id=$(this).attr('id');   
	 top.Dialog.open({URL:"__APP__/Custom/edit/id/"+id,Title:"客户业务备注",Width:850,Height:500});
    });
})

        /* 当鼠标移到表格上是，当前一行背景变色 */
      $(document).ready(function(){
		/* top.Dialog.open({URL:"Custom/add",Title:"新增业务人员 ",Width:600,Height:440});*/
            $(".data_list tr td").mouseover(function(){
                $(this).parent().find("td").css("background-color","#D6EDFF");
            });
      })
      /* 当鼠标在表格上移动时，离开的那一行背景恢复 */
      $(document).ready(function(){ 
            $(".data_list tr td").mouseout(function(){
                var bgc = $(this).parent().attr("bg");
                $(this).parent().find("td").css("background-color",bgc);
            });
      })
      
      $(document).ready(function(){ 
            var color="#F8F8F8"
            $(".data_list tr:odd td").css("background-color",color);  //改变偶数行背景色
            /* 把背景色保存到属性中 */
            $(".data_list tr:odd").attr("bg",color);
            $(".data_list tr:even").attr("bg","#fff");
      })
  function changeemp() {
      $('#searchform').attr("action", "{:U('index')}");
      $("#searchform").submit();
  }
  function  pagesizesave()
  {
      var size=$("#size").val();
      $("#pagesize").val(size);
      $("#form").submit();
  }
  function aaa()
  {
     window.location.reload();
  }
  function searchkey()
  {
	   url='__APP__/Custom/search/mark/'+$('#mark').val()+'/key/'+encodeURI($('#key').val());

       window.location.assign(url);
     // location=url;
  }
  function rebuildulr(key,val)
  {
      var myhash = {"level":"0", "adduser":"0","interval":"1","type":0,"st":"0","et":"0","remark":"0"};
      var path = window.location.pathname;
      var pos = path.lastIndexOf(".html")
      if (pos != -1)
          path = path.substring(0, pos);


      pos = path.indexOf("Custom/index")
      var parastr = path.substring(pos + 12); //12=len("custom/index")


      if (parastr.length > 0) {
          if (parastr.substr(0, 1) == '/') parastr = parastr.substring(1);
          parastr=parastr.replace(" ","");
          if (parastr.substr(parastr.length-1) == '/') parastr = parastr.substring(0,parastr.length-1);

          var arrtmp = parastr.split("/");
          for (i = 0; i < arrtmp.length ;) {
              myhash[arrtmp[i]] = arrtmp[i + 1];
              i += 2;
          }
      }

      myhash[key]=val;
      var tempstr="";

      myhash["p"]="1";
      
      for (key in myhash) {
          tempstr+=key +"/"+ myhash[key]+"/";
      }

     
      
      var url="__APP__/Custom/index/"+tempstr;
      //alert(url);

      window.location.assign(url);
  }

  function search()
  {
	  var myhash = {"level":"0", "adduser":"0","interval":"1","type":0,"st":"0","et":"0","remark":"0"};
      var path = window.location.pathname;
      var pos = path.lastIndexOf(".html")
      if (pos != -1)
          path = path.substring(0, pos);


      pos = path.indexOf("Custom/index")
      var parastr = path.substring(pos + 12); //12=len("custom/index")


      if (parastr.length > 0) {
          if (parastr.substr(0, 1) == '/') parastr = parastr.substring(1);
          var arrtmp = parastr.split("/");
          for (i = 0; i < arrtmp.length / 2;) {
              myhash[arrtmp[i]] = arrtmp[i + 1];
              i += 2;
          }
      }

      myhash["st"]=$("#st").val()==""?"0":$("#st").val();      
      myhash["et"]=$("#et").val()==""?"0":$("#et").val();
      var tempstr="";
      myhash["p"]="1";
      
      for (key in myhash) {
          tempstr+=key +"/"+ myhash[key]+"/";
      }

      var url="__APP__/Custom/index/"+tempstr;

      window.location.assign(url);
  }

  function exportCustoms()
  {
      $('#searchform').attr("action", "{:U('ExportCustoms')}");
      //alert( $("#searchform").attr("action"));
      $('#searchform').submit();
  }

  function searchCustoms()
  {
      $('#searchform').attr("action", "{:U('index')}");
      $('#searchform').submit();
  }

  function searchlevelCustom(o,ctype)
  {
      o.className="nav_current";
      $('#searchform').attr("action", "{:U('index')}");
      $('#level').val(ctype);
      $('#searchform').submit();
  }

  function doClick(o,ctype){
      o.className="nav_current";
      var j;
      var id;
      var oUl=$("#typelist");
      var olis=oUl.children() ;
      rebuildulr("level",ctype);
     // window.location="__APP__/Custom/index/level/"+ctype;

 /*     for(var i=1;i<=olis.length;i++){ //这里3 需要你修改 你多少条分类 就是多少
          id ="nav"+i;
          j = document.getElementById(id);

          if(id != o.id){
              j.className="nav_link";
          }
      }*/
  }


 function editcustom(id){ 
 
 		 top.Dialog.open({URL:"__APP__/Custom/add/id/"+id,Title:"编辑客户",Width:600,Height:480});
	  
 }

	function remarkSortBy()
    {
	  var remark=$("#remark").attr('sortby');
	  rebuildulr("remark",remark);
	}
 
  
  </script>

</head>
<body>
<form method="post" action="{:U('pagesizesave')}" id="form"><input
	type="hidden" id="pagesize" name="pagesize" /></form>
<div id="messWindow" class="messWindow"></div>
<div id="promptWindow" class="promptWindow" align="center">
<div class="titleBar"></div>

</div>
<script type="text/javascript" src="__PUBLIC__/js/showdate.js"></script>
<ul class="tools">
	<LI class=add p="50" style="cursor: pointer;">
        <SPAN>
            <A onclick='top.Dialog.open({URL:"__APP__/Custom/add/",Title:"添加新客户 ",Width:600,Height:480});'">新增客户</A>
	    </SPAN>
    </LI>
    <form  method="get" action="{:U('index')}" id="searchform">
    <li class="listemp">
        <span>员工列表</span>

        <select name="adduser" id="adduser" keepDefaultStyle="true" onChange="changeemp();">
            <option value="-1">全部</option>
            <volist name="emp_list" id="vo">
                <option value="{$vo['id']}"
                <?php if($adduser==$vo['id']) echo "selected" ?>>{$vo['name']}</option>
            </volist>
        </select>

        日期:<input type="text" id="st" name="st"  onclick="return Calendar('st');" class="text" style="width:85px;"
                  value="<?php echo I('get.st')=="0"? "":I('get.st') ?>"/>
            -
            <input type="text" id="et"  onclick="return Calendar('et');"  name="et" class="text"  style="width:85px;"
               value="<?php echo I('get.et')=="0"? "":I('get.et') ?>"/>
    </li>
	<li>
        <select name="mark" id="mark" keepDefaultStyle="true">
            <option value="1"  <?php if($mark=='1') echo "selected";?>>公司名称</option>
            <option value="0" <?php if($mark=='0') echo "selected";?>   >负责人</option>
            <option value="2"  <?php if($mark=='2') echo "selected";?>>电话号码</option>
            <option value="3"  <?php if($mark=='3') echo "selected";?>>公司地址</option>
            <option value="4"  <?php if($mark=='4') echo "selected";?>>备注</option>
	    </select>
        关键词：<input type="text" name="keywords" id="keywords" class="searchTitle"  value="{$keywords}" />
        <input type="button" value="搜索 " onclick="searchCustoms();"/>

       <!-- <input type="button" value="搜索 " onclick="search();" />-->
        <input type="button" value="导出 " onclick="exportCustoms();" />

        <input type="hidden" id="level" name="level" value="<?php echo I('get.level',0) ?>" >
        <input type="hidden" id="interval" name="interval" value="<?php echo I('get.interval',1) ?>" >


	</li>

	</form>
</ul>

<ul class="navul" id='typelist'>
	<li <?php
	 $type=I('get.level',0);
	 if($type==0)
	    echo 'class="nav_current" ';
	 else
	    echo 'class="nav_link" '; ?> id="nav1" onclick="javascript:searchlevelCustom(this,0)">
    <a href="javascript:void(0);"> 所有客户 </a></li>

	<volist name="custtype_list" id="vo">
	<li <?php
	 $type=I('get.level',0);
	 if($type==$vo['id'])
	    echo 'class="nav_current" ';
	 else
	     echo 'class="nav_link" '; ?>
	id="nav{$key+2}" onclick="javascript:searchlevelCustom(this,{$vo['id']})">
        <a href="javascript:void(0);">{$vo['name']}</a></li>
	</volist>
</ul>


<div class="mainBox">
<table width="100%" border="0" cellpadding="0" cellspacing="0"
	class="data_list">
	<tr>
		<th width="5%">负责人</th>
		<th width="10%">公司名称</th>
		<th width="5%">联系电话</th>
		<th width="15%">公司产品</th>
		<th width="5%">
		      <a id="remark" sortby="1" onclick="remarkSortBy();">业务备注</a>   
		</th>
		<th width="5%">录入人</th>
		<th width="5%">最后联系</th>
		<th width="5%">添加日期</th>
		<th width="10%">操作</th>
	</tr>
	<volist name="accounts_list" id="vo">
	<tr id="{$vo['id']}">
		<td>{$vo['cname']}</td>
		<td>{$vo['company']}</td>
		<td>{$vo['tel']}</td>
		<td>{$vo['userproduct']}</td>
		<td width="25%" class="remarktd" id="{$vo['id']}"><font color="red">
            <?php
                $rcontent=$remarkdata[$vo['id']]['content'];
            ?>
		{$rcontent|msubstr=0,30,'utf-8',true} </font></td>
		<td>
		 <?php
		     $rname=$employees[$vo['adduser']]['name'];
		  ?>
		    {$rname}
		</td>
		
		<td>
            <?php
                $rlxtime=$remarkdata[$vo['id']]['lxtime'];
            ?>
            {$rlxtime}</td>
		<td>{$vo['addtime']}</td>
		<td>
            <a href="__APP__/Appointment/newitem/id/{$vo['id']}">预约</a> /
    <a  href="javascript:void(0);"  onclick="editcustom({$vo['id']});"> 编辑 </a> /
<a href="__URL__/customgiveup/id/{$vo['id']}">放弃</a>

		</td>
	</tr>
	</volist>
</table>
</div>
<div id="TourExPage" class="page">{$page_method}</div>
</body>
</html>
